package cn.thoughtworks.school.feign;

import cn.thoughtworks.school.commands.CreateUserCommand;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;


@FeignClient(name = "${feign.authCenter.name}",
    url = "${feign.authCenter.url}")
@Service
public interface AuthCenterFeign {

  @PostMapping("/api/auth/users/register")
  ResponseEntity<Map> register(@RequestBody CreateUserCommand command);

  @PostMapping("/api/auth/username")
  Map usernameLogin(@RequestBody CreateUserCommand user);

  @PostMapping("/api/auth/users/joinProgram/userId/{id}")
  Map JoinProgramByUserId(@PathVariable(value="id") Long id, @RequestBody CreateUserCommand user);
}
